home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / technote / tchntstc.sit / Technical Notes Stack 3.2.1 / Technical Notes Stack 3.2.1 / card_41460.txt < prev    next >
Encoding:
Text File  |  1990-01-08  |  4.3 KB  |  77 lines

  1. -- card: 41460 from stack: in.1
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2711
  5. -- name: 131 TextEdit Bugs in System 4.2
  6.  
  7.  
  8. -- part contents for background part 9
  9. ----- text -----
  10. #131: TextEdit Bugs in System 4.2
  11.  
  12. Written by:     Chris Derossi    June 1, 1987
  13. Updated:                         March 1, 1988
  14. _______________________________________________________________________________
  15.  
  16. This note formerly described the known bugs with the version of Styled TextEdit that was provided with System 4.1. Many of these bugs were fixed in System 4.2. This updated Technical Note describes the remaining known problems.
  17. _______________________________________________________________________________
  18.  
  19.  
  20. TEStylInsert
  21.  
  22. Calling TEStylInsert while the TextEdit record is deactivated causes unpredictable results, so make sure to only call TEStylInsert when the TextEdit record is active.
  23.  
  24.  
  25. TESetStyle
  26.  
  27. When using the doFace mode with TESetStyle, the style that you pass as a parameter is ORed into the style of the currently selected text. If you pass the empty set (no styles) though, TESetStyle is supposed to remove all styles from the selected text. But TESetStyle checks an entire word instead of just the high-order byte of the tsFace field. The style information is contained completely in the high-order byte, and the low-order byte may contain garbage.
  28.  
  29. If the low-order byte isnΓÇÖt zero, TESetStyle thinks that the tsFace field isnΓÇÖt empty, so it goes ahead and ORs it with the selected textΓÇÖs style. Since the actual style portion of the tsFace field is zero, no change occurs with the text. If you want to have TESetStyle remove all styles from the text, you can explicitly set the tsFace field to zero like this:
  30.  
  31.     VAR
  32.        myStyle  : TextStyle;
  33.        anIntPtr : ^Integer;
  34.  
  35.     BEGIN
  36.        ...
  37.        anIntPtr := @myStyle.tsFace;
  38.        anIntPtr^ := 0;
  39.        TESetStyle(doFace, myStyle, TRUE, textH);
  40.        ...
  41.     END;
  42.  
  43.  
  44. TEStylNew
  45.  
  46. The line heights array does not get initialized when TEStylNew is called. Because of this, the caret is initially drawn in a random height. This is easily solved by calling TECalText immediately after calling TEStylNew. Extra calls to TECalText donΓÇÖt hurt anything anyway, so this will be compatible with future Systems.
  47.  
  48. An extra character run is placed at the beginning of the text which corresponds to the font, size, and style which were in the grafPort when TEStylNew was called. This can cause the line height for the first line to be too large. To avoid this, call TextSize with the desired text size before calling TEStylNew. If the textΓÇÖs style information cannot be determined in advance, then call TextSize with a small value (like 9) before calling TEStylNew.
  49.  
  50.  
  51. TEScroll
  52.  
  53. The bug documented in Technical Note #22 remains in the new TextEdit. TEScroll called with zero for both vertical and horizontal displacements causes the insertion point to disappear. The workaround is the same as before; check to make sure that dV and dH are not both zero before calling TEScroll.
  54.  
  55.  
  56. Growing TextEdit Record
  57.  
  58. TextEdit is supposed to dynamically grow and shrink the LineStarts array in the TERec so that it has one entry per line. Instead, when lines are added, TextEdit expands the array without first checking to see if itΓÇÖs already big enough. In addition, TextEdit never reduces the size of this array.
  59.  
  60. Because of this, the longer a particular TextEdit record is used, the larger it will get. This can be particularly nasty in programs that use a single TERec for many operations during the programΓÇÖs execution. 
  61.  
  62.  
  63. Restoring Saved TextEdit Records
  64.  
  65. Applications have used a technique for saving and restoring styled text which involves saving the contents of all of the TextEdit record handles. When restoring, TEStylNew is called and the TextEdit recordΓÇÖs handles are disposed. The saved handles are then loaded and put into the TextEdit record. This technique should not be used for the nullStyle handle in the style record.
  66.  
  67. Instead, when TEStylNew is called, the nullStyle handle from the style record should be copied into the saved style record. This will ensure that the fields in the null-style record point to valid data.
  68.  
  69.  
  70.  
  71. -- part contents for background part 2
  72. ----- text -----
  73. 131
  74.  
  75. -- part contents for background part 7
  76. ----- text -----
  77. TextEdit Bugs in System 4.2